from django.urls import path, register_converter

from apps.users.views import UsernameCountView, RegisterView, MobilesCountView

from utils.converters import UsernameConverter, MobilesConverter

# 注册用户名验证的转换器 别名叫 uname
register_converter(UsernameConverter, "uname")
# 注册手机号验证的转换器 别名叫 mobile
register_converter(MobilesConverter, "phone")


urlpatterns = [
    path('usernames/<uname:username>/count/', UsernameCountView.as_view()),
    path('mobiles/<phone:mobiles>/count/', MobilesCountView.as_view()),
    path('register/', RegisterView.as_view())
]
